
const Minio = require('minio')
const zlib = require('zlib')
const BUCKET_NAME = 'config';
var minioClient = new Minio.Client({
  endPoint: '127.0.0.1',
  port: 8006,
  useSSL: false,
  accessKey: 'Jl2kmlyDTprWPT6r',
  secretKey: 'p227aFTmICzQi40KknCTdLTL6e72NaQX'
});
function saveFile(
  content
) {
  return new Promise((resolve, reject) => {
    if (!BUCKET_NAME) {
      reject("No BUCKET_NAME provided");
      return;
    }
    var metaData = {
      ACL: "public-read",
      "cache-control": "public, max-age=0",
    }
    minioClient.putObject(BUCKET_NAME, `gepik-host/ip.txt`, content,content.length, metaData, function(err, response) {
      if (err) {
        console.error(err);
        reject(err);
        return;
      }
      resolve(content);
  })
  });
}
saveFile('115.206.1.166')
module.exports = {
  saveFile,
}
